package com.isoft.hospital.controller;

import com.isoft.hospital.common.ResponseData;
import com.isoft.hospital.entity.Department;
import com.isoft.hospital.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DepartmentController {
    @Autowired
    private DepartmentService service;
    @RequestMapping("/selectAlldepartment")
     public ResponseData selectAll(){
        ResponseData rd=service.selectAll();
        return rd;

     }
     @RequestMapping("/insertdepartment")
    public ResponseData insert(Department department){  //department 的封装
        ResponseData rd=service.insert(department);   //与service类关联
        return rd;
     }
     @RequestMapping("/deletedepartment")
    public ResponseData delete(int d_id){
        ResponseData rd=service.delete(d_id);
        return rd;
     }
     @RequestMapping("/updatedepartment")
    public ResponseData update(Department department){
        ResponseData rd =service.update(department); //与service关联
        return rd;

     }
    @GetMapping("/findById")
    public ResponseData findById(int d_id){
        ResponseData rd=service.findById(d_id);
        return rd;
    }
}

